package checkers.gui.panels;

import checkers.common.Texture;
import checkers.common.Settings;
import java.awt.Toolkit;
import java.util.ResourceBundle;
import javax.swing.ImageIcon;

/**
 * Class LoadingPanel
 * Creates JPanel with loading gif and text 
 * 
 * @author Cristian Tardivo
 */
public class LoadingPanel extends javax.swing.JPanel {
    private static final ResourceBundle lang = ResourceBundle.getBundle("checkers/common/lang");

    /**
     * Creates new form LoadingPanel
     */
    public LoadingPanel() {
        initComponents();
        ImageIcon imageIcon = new Texture(Texture.Gifs.load);
        gif_lbl.setIcon(imageIcon);
        imageIcon.setImageObserver(gif_lbl);
        // Set size (height) to window height (take off menubar and window title size)
        int height;
        if(Settings.isMaximized() == 6)
            height = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
        else
            height = Settings.getSize().height;
        setMaximumSize(new java.awt.Dimension(0, height - 100));
        setMinimumSize(new java.awt.Dimension(0, height - 100));
        setPreferredSize(new java.awt.Dimension(0, height - 100));
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        load_lbl = new javax.swing.JLabel();
        gif_lbl = new javax.swing.JLabel();

        setLayout(new java.awt.GridBagLayout());

        load_lbl.setText(lang.getString("LOADING_GAME")); // NOI18N
        add(load_lbl, new java.awt.GridBagConstraints());
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 1;
        add(gif_lbl, gridBagConstraints);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel gif_lbl;
    private javax.swing.JLabel load_lbl;
    // End of variables declaration//GEN-END:variables
}
